<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="layui-fluid">

    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-card-header" style="color:#d02e25;font-family: '楷体'; ">
                入党申请
            </div>



        </div>
        <div class="layui-card-body">
            <table id="rdsqlist" lay-filter="rdsqlist"></table>
        </div>
    </div>


</div>


<%--<form class="layui-form" id="form1">--%>
    <%--<div class="layui-card">--%>
        <%--<div class="layui-card-body">--%>
            <%--<div class="layui-form-item">--%>
                <%--<label class="layui-form-label">姓名</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="name" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>

                <%--<label class="layui-form-label">头像</label>--%>
                <%--<img src="/static/images/party/img/1.png">--%>
            <%--</div>--%>

            <%--<div class="layui-form-item">--%>

                <%--<label class="layui-form-label">性别</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="sex" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>

                <%--<label class="layui-form-label">入党申请书</label>--%>
                <%--<button type="button" class="layui-btn" id="openBook" >打开</button>--%>
                <%--<input type="text" name="book" id="book" value="http://127.0.0.1:2018/static/images/party/img/100.doc" lay-verify="required"--%>
                       <%--autocomplete="off" class="layui-input" style="display: none;">--%>
            <%--</div>--%>

            <%--<div class="layui-form-item">--%>

                <%--<label class="layui-form-label">入党党支部</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="branch" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>

                <%--<label class="layui-form-label">电话号码</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="tellphone" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>
            <%--</div>--%>

            <%--<div class="layui-form-item">--%>

                <%--<label class="layui-form-label">教育水平</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="education" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>

                <%--<label class="layui-form-label">特长介绍</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="introduce" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>
            <%--</div>--%>

            <%--<div class="layui-form-item">--%>

                <%--<label class="layui-form-label">籍贯</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="birthPlace" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>

                <%--<label class="layui-form-label">毕业院校</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="school" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>
            <%--</div>--%>

            <%--<div class="layui-form-item">--%>

                <%--<label class="layui-form-label">现居地</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="livePlace" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>

                <%--<label class="layui-form-label">职业</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="occupation" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>
            <%--</div>--%>

            <%--<div class="layui-form-item">--%>

                <%--<label class="layui-form-label">所属行业</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="industry" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>

                <%--<label class="layui-form-label">身份证号码</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="idCard" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>
            <%--</div>--%>

            <%--<div class="layui-form-item">--%>

                <%--<label class="layui-form-label">申请时间</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="updateTime" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>

                <%--<label class="layui-form-label">民族</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="nation" lay-verify="required"--%>
                           <%--autocomplete="off" class="layui-input">--%>
                <%--</div>--%>
            <%--</div>--%>
        <%--</div>--%>


    <%--</div>--%>
<%--</form>--%>



<script type="application/javascript"></script>

<script>
    layui.use(['table','form'], function(){
        var table = layui.table
            ,form = layui.form;

        //组织关系转接列表
        table.render({
            elem: '#rdsqlist'
            // ,height: 'full-200'
            ,method: 'post'
            ,url: '/ajax/party/admin/rdsqlist'
            ,page: true
            ,loading: true
            ,cellMinWidth: 80
            ,limit: 10
            ,id: 'rdsqlist'
            ,cols: [[
                {field: 'id', title: 'ID', width: 80, sort: true, fixed: 'left'}
                ,{field: 'name', title: '姓名',edit:'text',width: 100}
                ,{field: 'sex', title: '性别',templet:'#sex2',edit:'text',width: 80}
                ,{field: 'education', title: '学历',edit:'text'}
                ,{field: 'branch', title: '入党党支部',edit:'text'}
                ,{field: 'introduce', title: '特长介绍',edit:'text'}
                ,{fixed: 'right', title: '操作', align: 'center', width: 120, toolbar: '#dothing' }
            ]]
        });
        //监听工具条
        table.on('tool(rdsqlist)', function(obj){
            var data = obj.data;

            if(obj.event === 'detail'){

                $.post('/ajax/party/admin/getOneRd',{
                    id:data.id
                },function(result){
                    layer.open({
                        type: 1,
                        area: ['800px','80%'],
                        title: "ID:" + data.id,
                        offset: '10%',
                        anim: 4,
                        shadeClose: true,
                        content: showdetails(result.data)
                    });
                    console.log(result);
                    //打开入党申请书
                    $("#openBook").click(function () {
                        var path = $("#applyBook").val();
                        // alert(data.time);
                        // path = "\""+path +"\"";
                        // alert(path);
                        //仅限ie  直接打开word
                        // var openDocObj;
                        // openDocObj = new ActiveXObject("SharePoint.OpenDocuments.2");
                        // openDocObj.editDocument(path);

                        $.post("/ajax/party/admin/getApplyBook",{
                            path:path,
                            time:data.time
                        },function (res) {
                            if(res.code!=0){
                                alert("出了一点小问题，暂时无法查看哦`");
                            }else {
                                window.open("/static/generic/web/viewer.html?file=/ajax/party/admin/preview?"+path);
                            }
                        })

                    })
                    });


            } else if(obj.event === 'del'){
                layer.confirm('真的删除行么', function(index){
                    $.post("/ajax/party/admin/delrdsq",{
                        id:data.id
                    },function(result){
                        console.log(result);
                        if(result.code==0){
                            layer.alert("删除成功！");
                        }
                        obj.del();
                        layer.close(index);
                    });
                });
            }
        });





    });
</script>

<script>
    function showdetails(data) {
        console.log(data);
        if(data.sex=="1"){
            data.sex="男";
        }else if(data.sex==0){
            data.sex="女";
        }
        var s = '<form class="layui-form" id="form1">\n' +
            '    <div class="layui-card">\n' +
            '        <div class="layui-card-body">\n' +
            '            <div class="layui-form-item">\n' +
            '                <label class="layui-form-label">姓名</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="name" value='+ data.name +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">头像</label>\n' +
            '                <img style="width: 80px; height: 65px;" src="http://127.0.0.1:19000'+ data.icon +'">\n' +
            '            </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '\n' +
            '                <label class="layui-form-label">性别</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="sex" value='+ data.sex +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">入党申请书</label>\n' +
            '                <button type="button" class="layui-btn" id="openBook" >打开</button>\n' +
            '                <input type="text" name="applyBook" id="applyBook" value='+ data.applyBook +' lay-verify="required"\n' +
            '                       autocomplete="off" class="layui-input" style="display: none;">\n' +
            '            </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '\n' +
            '                <label class="layui-form-label">入党党支部</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="branch" value='+ data.branch +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">电话号码</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="tellphone" value='+ data.tellphone +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '\n' +
            '                <label class="layui-form-label">教育水平</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="education" value='+ data.education +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">特长介绍</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="introduce" value='+ data.introduce +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '\n' +
            '                <label class="layui-form-label">籍贯</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="birthPlace" value='+ data.birthPlace +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">毕业院校</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="school" value='+ data.school +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '\n' +
            '                <label class="layui-form-label">现居地</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="livePlace" value='+ data.livePlace +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">职业</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="occupation" value='+ data.occupation +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '\n' +
            '                <label class="layui-form-label">所属行业</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="industry" value='+ data.industry +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">身份证号码</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="idCard" value='+ data.idCard +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '\n' +
            '                <label class="layui-form-label">申请时间</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="updateTime" value='+ data.updateTime +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">民族</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="nation" value='+ data.nation +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '        </div>\n' +
            '\n' +
            '\n' +
            '    </div>\n' +
            '</form>';

        return s;
    }


</script>


<script type="text/html" id="dothing">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>

    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>

<script type="text/html" id="sex2">

    {{#  if( d.sex == 1){ }}
    {{ d.ispublic='男' }}
    {{#  }  }}
    {{#  if( d.ispublic == 0){ }}
    {{ d.ispublic='女' }}
    {{#  }  }}

</script>